package Text_41;

import java.util.ArrayList;
import java.util.Scanner;

public class Code {

	public static void main(String[] args) {
		 //求公因子数目
        Scanner sc =  new Scanner(System.in);
        //定义一个集合用于接收公因数
        ArrayList<Integer> list = new ArrayList<>();
        System.out.println("请输入两个整数：");
        int num1 = sc.nextInt();
        int num2 = sc.nextInt();
        //求最小值
        int min = num1<num2?num1:num2;
        //求最大值
        int max = num1>num2?num1:num2;
        //求最小值的公因数
        for (int i = 1; i <=min ; i++) {
            int s = min%i;
           if(s ==0){
               //放入集合
               list.add(i);
           }
        }
        //计数
        int count = 0;
        //从集合中遍历求最大值的公因数
        for (int i = 0; i <list.size() ; i++) {
          int s = max% list.get(i);
          if(s==0){
              count++;
             // System.out.print(list.get(i)+" ");
           }
        }
        System.out.println(count);

	}

}
